package com.zwan.oam_rtc.utils.messages;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;

import java.nio.ByteBuffer;

/***
 * 视频会议回调结果消息
 * callflowId
 * callbackUrl
 * callstatus
 * @author 
 *
 */

public class ConfCallResultMessage extends AbstractStruct {
    
//    callflowid	Varchar2(20)
//    callbackurl	Varchar2(300)
//    Callstatus	Integer

    private byte[] messageBodyHeader = new byte[8];
    private byte[] callFlowId = new byte[20];
    private byte[] callBackUrl = new byte[300];
    private byte[] number = new byte[29];
    private byte[] callStatus = new byte[4];
    private byte[] recordUrl = new byte[255];
    private byte[] confid = new byte[30];

    private static int LENGTH = 8+20+300+29+4+255+30;
    
    /**
     * 返回消息写入buffer
     */
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(messageBodyHeader);
        bf.put(callFlowId);
        bf.put(callBackUrl);
        bf.put(number);
        bf.put(callStatus);
        bf.put(recordUrl);
        bf.put(confid);
    }

    /**
     * buffer读出返回消息
     */
    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(messageBodyHeader);
        bf.get(callFlowId);
        bf.get(callBackUrl);
        bf.get(number);
        bf.get(callStatus);
        bf.get(recordUrl);
        bf.get(confid);
    }

    public String getCallFlowId() {
        return ByteTransfer.getString(callFlowId);
    }

    public void setCallFlowId(String callFlowId) {
    	ByteTransfer.str2Byte(callFlowId, this.callFlowId);
    }
    
    public String getCallBackUrl() {
        return ByteTransfer.getString(callBackUrl);
    }

    public void setCallBackUrl(String callBackUrl) {
    	ByteTransfer.str2Byte(callBackUrl, this.callBackUrl);
    }

    public String getCallStatus() {
        return ByteTransfer.getString(callStatus);
    }

    public void setCallStatus(String callStatus) {
        ByteTransfer.str2Byte(callStatus, this.callStatus);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }

    public String getRecordUrl() {
        return ByteTransfer.getString(recordUrl);
    }

    public void setRecordUrl(String recordUrl) {
        ByteTransfer.str2Byte(recordUrl, this.recordUrl);
    }

    public String getConfid() {return  ByteTransfer.getString(confid); }

    public String getNumber() {return  ByteTransfer.getString(number); }

}
